package com.caterina.components;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class CAlphaPanel extends CPanel implements MouseListener{
	public CAlphaPanel() {
       this(0.8);
    }
	public CAlphaPanel(double percent) {
        super();
        this.percent=percent;
        this.setOpaque(false);
        this.addMouseListener(this);
        this.r=new Rectangle(0,0,50000,50000);
    }
	@Override
	public void setBounds(Rectangle r) {
		this.r=r;
		super.setBounds(r);
	}
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        Color ppColor = new Color(3, 3, 3, (int) (255*percent)); //r,g,b,alpha
        g.setColor(ppColor);
        g.fillRect(r.x,r.y,r.width,r.height); //x,y,width,height
    }
    
	private static final long serialVersionUID = 1L;
    int blockType;
	@Override
	public void mouseClicked(MouseEvent e) {
		e.consume();
	}
	@Override
	public void mouseEntered(MouseEvent e) {
		e.consume();	
	}
	@Override
	public void mouseExited(MouseEvent e) {
		e.consume();
	}
	@Override
	public void mousePressed(MouseEvent e) {
		e.consume();
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		e.consume();
	}
	private double percent;
	private Rectangle r;
}
